#coding: utf-8

from typing import List

class Solution:
    def longestCommonPrefix(self, strs: List[str]) -> str:
        ans =''
        current = 0
        while 1:
            if current >= len(strs[0]):
                break
            ch = strs[0][current]
            i = 1
            while i< len(strs):
                if current>=len(strs[i]) or strs[i][current]!=ch:
                    break
                else:
                    i = i+1
            if i==len(strs):
                ans = ans+ch
                current = current + 1
            else:
                break    

        return ans
                    

if __name__ == '__main__':
    solu = Solution()
    print(solu.longestCommonPrefix(["flower","flow","flight"]))
